package com.xiaoma.base;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import org.reflections.Reflections;

/**
 * @author xiaomacdut
 * @date 2020年3月6日 下午3:00:29
 */
public class ServiceUtil{
    
    public <T> T getSubClass() throws InstantiationException, IllegalAccessException{
         
        Map<String, IPeople> myServiceMap = new HashMap<>();
         
        Reflections reflections = new Reflections(IPeople.class.getPackage().getName());
        
        Set<Class<? extends IPeople>> myClasses = reflections.getSubTypesOf(IPeople.class);
        
        for(Class<? extends IPeople> myClass : myClasses){
            if(myClass.isAssignableFrom(ManImpl.class)){
                return (T) myClass.newInstance();
            }
            
            // myServiceMap.put(IPeople.getType(), IPeople);
        }
        
        return null;
         
        
    }
}
